﻿using MengLin.OOP.DesignPattern.State.RoomManagerSys.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.State.RoomManagerSys.Entity
{
    /// <summary>
    /// 房间类
    /// 也叫环境类（状态的使用者）
    /// </summary>
    public class Room
    {
        private AbstractState _state;

        /// <summary>
        /// 得到房间的状态
        /// </summary>
        /// <returns></returns>
        public string GetState()
        {
            return _state.GetState();
        }

        /// <summary>
        /// 设置房间的状态
        /// </summary>
        /// <returns></returns>
        public void SetState(AbstractState state)
        {
            _state = state;
        }

        /// <summary>
        /// 预订房间
        /// </summary>
        /// <returns></returns>
        public void Book()
        {
            _state.Book(this);
        }

        /// <summary>
        /// 入住
        /// </summary>
        /// <returns></returns>
        public void CheckIn()
        {
            _state.CheckIn(this);
        }

        /// <summary>
        /// 退订房间
        /// </summary>
        /// <returns></returns>
        public void UnBook()
        {
            _state.UnBook(this);
        }

        /// <summary>
        /// 退房
        /// </summary>
        /// <returns></returns>
        public void CheckOut()
        {
            _state.CheckOut(this);
        }
    }
}
